import axios from "./axios";
import { processResponse } from "./util";

export default {
  serviceList(query) {
    return processResponse(axios.get("/service/query", { params: query }));
  },
  serviceAdd(query) {
    return processResponse(axios.post("/service", query));
  },
  serviceEdit(query) {
    return processResponse(axios.put("/service", query));
  },
  serviceGet(id,query) {
    return processResponse(axios.get("/service/" + id, query));
  },
  // 获得代理商区域
  Agentregions(query) {
    return processResponse(axios.get("/agent/current", { query }));
  },
   // 获得省
  regions(query) {
    return processResponse(axios.get("/regions/root", { query }));
  },
  // 获得城市
  city(value,query) {
    return processResponse(axios.get("/regions/" + value + "/children", { query }));
  },
  // 获得县
  county(value,query) {
    return processResponse(axios.get("/regions/" + value + "/children", { query }));
  },
  // 获得方案列表
  scheme(query) {
    return processResponse(axios.get("/scheme/query", { query }));
  },
  // 获得服务商查看id
  serviceShow(id,query) {
    return processResponse(axios.get("/service/" + id, { query }));
  },
  // 获得服务商开启
  serviceStart(id,query) {
    return processResponse(axios.get("/service/startup/" + id, { query }));
  },
  // 获得服务商停止
  serviceEnd(id,query) {
    return processResponse(axios.get("/service/termination/" + id, { query }));
  },
  // 获得服务商续时
  serviceRenew(id,years,query) {
    return processResponse(axios.get("/service/" + id + '/renew/' + years, { query }));
  },
   // 获取服务商日志
  serviceLogLook(id, query) {
    return processResponse(axios.get('/log/query-service-log/' + id), {query})
  },
  // 激活码解绑
  unbinging(id, query) {
    return processResponse(axios.get("/activation/unbinging/" + id, { query }));
  },
  // 激活码解绑
  activationDelete(id, query) {
    return processResponse(axios.delete("/activation/" + id, { query }));
  },
  // 服务商分页请求
  servicePage(page, size, query) {
    return processResponse(
      axios.get('/service/query?page=' + page + '&size=' + size, {
        params: query
      })
    )
  },
};
